package two_shape;

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.effect.DropShadow;
import javafx.scene.paint.Color;
import javafx.scene.shape.CubicCurve;
import javafx.stage.Stage;

/**
 * 三次曲线
 */
public class CubicCurveExample extends Application {
    @Override
    public void start(Stage primaryStage) throws Exception {
        Group root = new Group();
        primaryStage.setTitle("Cubic Curve Example");
        CubicCurve c = new CubicCurve();
        //三次曲线起始点坐标
        c.setStartX(20);
        c.setStartY(100);
        //三次曲线第一控制点的X坐标
        c.setControlX1(300);
        //三次曲线第二控制点的X坐标
        c.setControlX2(200);
        c.setControlY1(100);
        c.setControlY2(90);
        c.setFill(Color.RED);
        //设置周围阴影
        c.setEffect(new DropShadow(10, Color.BLUE));
        c.setEndX(100);
        c.setEndY(300);
        root.getChildren().add(c);
        Scene scene = new Scene(root,300,400);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
